home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / libs / readline / rldefs.h < prev    next >
C/C++ Source or Header  |  1996-11-01  |  7KB  |  231 lines

  1. /* Modified by Klaus Gebhardt, 1996 */
  2. /* rldefs.h -- an attempt to isolate some of the system-specific defines
  3.    for readline.  This should be included after any files that define
  4.    system-specific constants like _POSIX_VERSION or USG. */
  5.  
  6. /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
  7.  
  8.    This file contains the Readline Library (the Library), a set of
  9.    routines for providing Emacs style line input to programs that ask
  10.    for it.
  11.  
  12.    The Library is free software; you can redistribute it and/or modify
  13.    it under the terms of the GNU General Public License as published by
  14.    the Free Software Foundation; either version 1, or (at your option)
  15.    any later version.
  16.  
  17.    The Library is distributed in the hope that it will be useful, but
  18.    WITHOUT ANY WARRANTY; without even the implied warranty of
  19.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20.    General Public License for more details.
  21.  
  22.    The GNU General Public License is often shipped with GNU software, and
  23.    is generally kept in a file called COPYING or LICENSE.  If you do not
  24.    have a copy of the license, write to the Free Software Foundation,
  25.    675 Mass Ave, Cambridge, MA 02139, USA. */
  26.  
  27. #if !defined (_RLDEFS_H)
  28. #define _RLDEFS_H
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if defined (HAVE_CONFIG_H)
  35. #  include "config.h"
  36. #endif
  37.  
  38. #if !defined (PRAGMA_ALLOCA)
  39. #  include "memalloc.h"
  40. #endif
  41.  
  42. #define NEW_TTY_DRIVER
  43. #define HAVE_BSD_SIGNALS
  44. /* #define USE_XON_XOFF */
  45.  
  46. #ifdef __MSDOS__
  47. #undef NEW_TTY_DRIVER
  48. #undef HAVE_BSD_SIGNALS
  49. #endif
  50.  
  51. #ifdef __EMX__
  52. #undef HAVE_BSD_SIGNALS
  53. #endif /* __EMX__ */
  54.  
  55. #if defined (__linux__) || defined (HAVE_TERMCAP_H)
  56. #  include <termcap.h>
  57. #endif /* __linux__ || HAVE_TERMCAP_H */
  58.  
  59. /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
  60. #if defined (USG) && !defined (hpux)
  61. #  undef HAVE_BSD_SIGNALS
  62. #endif
  63.  
  64. /* System V machines use termio. */
  65. #if !defined (_POSIX_VERSION)
  66. #  if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || \
  67.       defined (DGUX) || defined (HAVE_TERMIO_H)
  68. #    undef NEW_TTY_DRIVER
  69. #    define TERMIO_TTY_DRIVER
  70. #    include <termio.h>
  71. #    if !defined (TCOON)
  72. #      define TCOON 1
  73. #    endif
  74. #  endif /* USG || hpux || Xenix || sgi || DUGX || HAVE_TERMIO_H */
  75. #endif /* !_POSIX_VERSION */
  76.  
  77. /* Posix systems use termios and the Posix signal functions. */
  78. #if defined (_POSIX_VERSION)
  79. #  if !defined (TERMIOS_MISSING)
  80. #    undef NEW_TTY_DRIVER
  81. #    define TERMIOS_TTY_DRIVER
  82. #    include <termios.h>
  83. #  endif /* !TERMIOS_MISSING */
  84. #  define HAVE_POSIX_SIGNALS
  85. #  if !defined (O_NDELAY)
  86. #    define O_NDELAY O_NONBLOCK    /* Posix-style non-blocking i/o */
  87. #  endif /* O_NDELAY */
  88. #endif /* _POSIX_VERSION */
  89.  
  90. /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
  91. #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
  92. #  if defined (USGr3) && !defined (XENIX_22)
  93. #    if !defined (HAVE_USG_SIGHOLD)
  94. #      define HAVE_USG_SIGHOLD
  95. #    endif /* !HAVE_USG_SIGHOLD */
  96. #  endif /* USGr3 && !XENIX_22 */
  97. #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
  98.  
  99. /* Other (BSD) machines use sgtty. */
  100. #if defined (NEW_TTY_DRIVER)
  101. #  include <sgtty.h>
  102. #endif
  103.  
  104. #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
  105. #  if !defined (HAVE_DIRENT_H)
  106. #    define HAVE_DIRENT_H
  107. #  endif /* !HAVE_DIRENT_H */
  108. #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
  109.  
  110. #if defined (HAVE_DIRENT_H)
  111. #  include <dirent.h>
  112. #  define D_NAMLEN(d) strlen ((d)->d_name)
  113. #else /* !HAVE_DIRENT_H */
  114. #  define D_NAMLEN(d) ((d)->d_namlen)
  115. #  if defined (USG)
  116. #    if defined (Xenix)
  117. #      include <sys/ndir.h>
  118. #    else /* !Xenix (but USG...) */
  119. #      include "ndir.h"
  120. #    endif /* !Xenix */
  121. #  else /* !USG */
  122. #    include <sys/dir.h>
  123. #  endif /* !USG */
  124. #  if !defined (dirent)
  125. #    define dirent direct
  126. #  endif /* !dirent */
  127. #endif /* !HAVE_DIRENT_H */
  128.  
  129. #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
  130. #  if defined (HAVE_SYS_STREAM_H)
  131. #    include <sys/stream.h>
  132. #  endif /* HAVE_SYS_STREAM_H */
  133. #  if defined (HAVE_SYS_PTEM_H)
  134. #    include <sys/ptem.h>
  135. #  endif /* HAVE_SYS_PTEM_H */
  136. #  if defined (HAVE_SYS_PTE_H)
  137. #    include <sys/pte.h>
  138. #  endif /* HAVE_SYS_PTE_H */
  139. #endif /* USG && TIOCGWINSZ && !Linux */
  140.  
  141. /* Posix macro to check file in statbuf for directory-ness.
  142.    This requires that <sys/stat.h> be included before this test. */
  143. #if defined (S_IFDIR) && !defined (S_ISDIR)
  144. #  define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
  145. #endif
  146.  
  147. /* Decide which flavor of the header file describing the C library
  148.    string functions to include and include it. */
  149.  
  150. #if defined (USG) || defined (NeXT)
  151. #  if !defined (HAVE_STRING_H)
  152. #    define HAVE_STRING_H
  153. #  endif /* !HAVE_STRING_H */
  154. #endif /* USG || NeXT */
  155.  
  156. #if defined (HAVE_STRING_H)
  157. #  include <string.h>
  158. #else /* !HAVE_STRING_H */
  159. #  include <strings.h>
  160. #endif /* !HAVE_STRING_H */
  161.  
  162. #if !defined (strchr) && !defined (__STDC__)
  163. extern char *strchr (), *strrchr ();
  164. #endif /* !strchr && !__STDC__ */
  165.  
  166. #if defined (HAVE_VARARGS_H)
  167. #  include <varargs.h>
  168. #endif /* HAVE_VARARGS_H */
  169.  
  170. /* This is needed to include support for TIOCGWINSZ and window resizing. */
  171. #if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
  172.     defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
  173.     defined (AIX)
  174. #  define GWINSZ_IN_SYS_IOCTL
  175. #endif
  176.  
  177. /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
  178.    it is not already defined.  It is used both to determine if a
  179.    special character is disabled and to disable certain special
  180.    characters.  Posix systems should set to 0, USG systems to -1. */
  181. #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
  182. #  if defined (_SVR4_VDISABLE)
  183. #    define _POSIX_VDISABLE _SVR4_VDISABLE
  184. #  else
  185. #    if defined (_POSIX_VERSION)
  186. #      define _POSIX_VDISABLE 0
  187. #    else /* !_POSIX_VERSION */
  188. #      define _POSIX_VDISABLE -1
  189. #    endif /* !_POSIX_VERSION */
  190. #  endif /* !_SVR4_VDISABLE */
  191. #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
  192.  
  193.  
  194. #if !defined (emacs_mode)
  195. #  define no_mode -1
  196. #  define vi_mode 0
  197. #  define emacs_mode 1
  198. #endif
  199.  
  200. /* If you cast map[key].function to type (Keymap) on a Cray,
  201.    the compiler takes the value of map[key].function and
  202.    divides it by 4 to convert between pointer types (pointers
  203.    to functions and pointers to structs are different sizes).
  204.    This is not what is wanted. */
  205. #if defined (CRAY)
  206. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)((int)map[key].function)
  207. #  define KEYMAP_TO_FUNCTION(data)    (Function *)((int)(data))
  208. #else
  209. #  define FUNCTION_TO_KEYMAP(map, key)    (Keymap)(map[key].function)
  210. #  define KEYMAP_TO_FUNCTION(data)    (Function *)(data)
  211. #endif
  212.  
  213. #ifndef savestring
  214. extern char *xmalloc ();
  215. #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
  216. #endif
  217.  
  218. /* Possible values for _rl_bell_preference. */
  219. #define NO_BELL 0
  220. #define AUDIBLE_BELL 1
  221. #define VISIBLE_BELL 2
  222.  
  223. /* CONFIGURATION SECTION */
  224. #include "rlconf.h"
  225.  
  226. #ifdef __cplusplus
  227. }
  228. #endif
  229.  
  230. #endif /* !_RLDEFS_H */
  231.